import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart';
import 'package:mall/constant/app_colors.dart';
import 'package:mall/gen/r.dart';
import 'package:mall/ui/page/goods/widgets/goods_list.dart';
import 'package:mall/ui/widgets/default_bg.dart';
import 'package:mall/utils/image_component/image_component.dart';

class SearchResultPage extends StatefulWidget {
  const SearchResultPage({super.key});

  @override
  State<SearchResultPage> createState() => _SearchResultPageState();
}

class _SearchResultPageState extends State<SearchResultPage> {
  final itemStrings = [
    '综合',
    '销量',
    '价格',
  ];

  @override
  Widget build(BuildContext context) {
    return APPScaffold(
      title: '搜索结果',
      body: Padding(
        padding: const EdgeInsets.only(left: 15, right: 15),
        child: Column(
          children: [
            SizedBox(height: 10),
            Container(
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(10),
              ),
              height: 46,
              child: Row(
                children: [
                  Container(
                    width: 90,
                    child: DropdownButtonHideUnderline(
                      child: DropdownButton2(
                        isExpanded: true,
                        hint: Text(
                          '综合',
                          style: TextStyle(
                            fontSize: 13,
                            color: AppColors.C_222222,
                            fontWeight: FontWeight.bold,
                          ),
                        ),
                        // buttonStyleData: ButtonStyleData(
                        //   padding: EdgeInsets.only(left: 20, right: 0),
                        // width: 80,
                        // ),
                        items: itemStrings
                            .map((item) => DropdownMenuItem<String>(
                                  value: item,
                                  child: Text(item),
                                ))
                            .toList(),
                      ),
                    ),
                  ),
                  Spacer(),
                  //展示方式
                  ImageComponent(R.image.searchListStyleCell.path, width: 15, height: 15),
                  SizedBox(width: 20),
                ],
              ),
            ),
            SizedBox(height: 10),
            Expanded(
              child: GoodsListWidget(productList: []),
            ),
          ],
        ),
      ),
    );
  }
}
